import Vue from 'vue'
import VueRouter from 'vue-router'
import folders from '@/folders'
import Home from '@/views/Home.vue'

Vue.use(VueRouter)

const routes = folders.map((componentName) => ({
  path: `/${componentName}`,
  name: componentName,
  component: () => import(`@/components/${componentName}.vue`),
}))

const router = new VueRouter({
  routes: [
    {
      path: '/',
      name: 'Home',
      component: Home,
    },
    ...routes,
  ],
})

export default router
